package edu.ilstu.mind.ise.ccp.logger.console;

import java.util.Map;

import edu.ilstu.mind.ise.ccp.config.ConfigParserUtil;
import edu.ilstu.mind.ise.ccp.logger.Logger;
import edu.ilstu.mind.ise.ccp.logger.LoggerFactory;
import edu.ilstu.mind.ise.ccp.logger.LoggerLevel;


public class ConsoleLoggerFactory implements LoggerFactory {
	
	private final String PROP_KEY_LEVEL = "level";
	
	private final LoggerLevel level;
	
	public ConsoleLoggerFactory(LoggerLevel level) {
		this.level = level;
	}
	
	public ConsoleLoggerFactory(Map<String, Object> props) {
		level = LoggerLevel.parse(ConfigParserUtil.getRequiredString(props, PROP_KEY_LEVEL));
	}

	@Override
	public Logger createLogger(String name) {
		return new ConsoleLogger(name, level);
	}

}
